﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Guest.Master" AutoEventWireup="true"
    CodeBehind="Write.aspx.cs" Inherits="ScrumLite.WebUx.DeliverablesViews.Write" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
  <script type="text/javascript">
    function save()
    {
        var name = document.getElementById("name");
        var path = document.getElementById("path");
        var releasedOn = document.getElementById("releasedOn");
        
        if (name.value == "")
        {
            alert("must insert a name");
            return;
        }
        
        if (path.value == "")
        {
            alert("must insert an url path");
            return;
        }

        if (releasedOn.value == "")
        {
            alert("must insert a releasedOn date");
            return;
        }
        
        document.forms[0].submit();
    }
    </script>
    
    <h1>
        <%=ViewData.ProjectName%></h1>
    <hr />
    <h2>
        Deliverables</h2>
    <div class="actions">
        <a href="javascript:void(0);" tabindex="8" onclick="javascript:save();"> Save</a>&nbsp;&nbsp;&nbsp;
        <%= Html.ActionLink("Cancel", "List", "Deliverables") %>
    </div>
    <%
        if (ViewData.Message != null)
        {
    %>
    <div class="errorMessage">
    <%=ViewData.Message%>
    </div>
    <%
        }
    %>
    <br />
    <form name="deliverablesForm" id="deliverablesForm" action="<%=Url.Action(new { Action="Save", Controller = "Deliverables"  }) %> "
    method="post">
    <input name="id" id="id" type="hidden" value="<%=ViewData.Id != Guid.Empty ? ViewData.Id.ToString() : "" %>" />
    <p>
        <strong>Name</strong>&nbsp;&nbsp;(text) *<br />
        <input name="name" id="name" type="text" value="<%=ViewData.Name %>" />
        
    </p>
    <p>
        <strong>Url</strong>&nbsp;&nbsp;(uri) *<br />
        <input name="path" type="text" value='<%=ViewData.Path %>' size="80" />
        
    </p>
    <p>
        <strong>Released On</strong>&nbsp;&nbsp;(date) *<br />
        <input name="releasedOn" id="releasedOn" type="text" value='<%=ViewData.ReleasedOn.Date.ToString("yyyy-MM-dd") %>' />
        
    </p>
    <p>
        <% Html.RenderPartial("WorkAreasPicker", ViewData.WorkAreasPickerViewData); %>
    </p>
    <br />
    <div class="actions">
        <a href="javascript:void(0);" tabindex="8" onclick="javascript:save();">Save</a>&nbsp;&nbsp;&nbsp;
        <%= Html.ActionLink("Cancel", "List", "Deliverables") %>
    </div>
    </form>
</asp:Content>
